package edu.nctu.csie.jichang.spring;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import edu.nctu.csie.jichang.spring.bean.Interface;

public class Main {

	private Interface instance;
	private List<Interface> list;
	private List<String> strlist;
	
	public static void main(String[] args) {
		
		ApplicationContext tContext = new FileSystemXmlApplicationContext("beans-config.xml");
		
		System.out.println("-------------Test Ref-Bean-----------");
		Main tMain = tContext.getBean("main",Main.class);
		System.out.println( tMain.getInstance().getMsg() );
		
		System.out.println("-------------Test List-----------");
		System.out.println( tMain.getList() );
		
		System.out.println("-------------Test String List-----------");
		System.out.println( tMain.getStrlist() );
		
		System.out.println("-------------Test Class-----------");
		tContext.getBean("d",Interface.class);
		try {
			tContext.getBean("e",Interface.class);
		} catch (Exception e) {
			System.out.println(e.getLocalizedMessage());
		}
		
	}

	public Interface getInstance() {
		return instance;
	}
	public void setInstance(Interface instance) {
		this.instance = instance;
	}
	public List<Interface> getList() {
		return list;
	}
	public void setList(List<Interface> list) {
		this.list = list;
	}

	public List<String> getStrlist() {
		return strlist;
	}

	public void setStrlist(List<String> strlist) {
		this.strlist = strlist;
	}
}